﻿@using RBS.Web.Controllers
@model  RBS.Web.Models.UserOrder
@{
    ViewBag.Title = "订单确认";
    Layout = "~/Views/Shared/_Layout.cshtml";
     var uid = -1;
    if (Request.IsAuthenticated)
    {
        uid = Convert.ToInt32(Context.User.Identity.Name);
    } 
}
@using (Html.BeginForm())
{
    <div id="content">
        <div class="h1a">订单确认</div>
        <div class="detailinfo">
            <h1>@Model.Hotel.H_Name</h1>
            <dl class="fav"> 
                <dd class="fav1"> 
                    @Ajax.ActionLink("收藏", "AddHotle", "Collect", new {Area = "User", hotelid = @Model.Hotel.H_id}, new AjaxOptions
                        {
                            UpdateTargetId = "dailydeal",
                            InsertionMode = InsertionMode.Replace,
                            HttpMethod = "Get"
                        })
                </dd>   
                @*	<dd class="share">   @Html.ActionLink("预定","Order",new{hotelid=@Model.H_id},null )</dd>*@
            </dl>
            <dl class="score">
                <dd class="add">地址：<b>@Model.Hotel.Address</b></dd>
                <dd>电话：<b>@Model.Hotel.Telphone</b></dd>
                <dd>人均：<strong>￥50</strong></dd>
                <dd>营业时间：<b>10:00-22:00</b></dd>
            </dl>
        </div>
        <div id="mainContent"> 
            <div class="tab-content destineorder">
                <dl>
                    <dt>预订吃饭日期</dt>
                    <dd>
                        @Html.DisplayFor(model => model.Order.ReserveDate, null, new {@class = "input small w120", onfocus = "WdatePicker({dateFmt:'yyyy年MM月dd日',minDate:'%y-%M-{%d}'})"})
                        @Html.DisplayFor(model => model.Order.ReserveTime, null, new {@class = "input small w100", onfocus = "WdatePicker({dateFmt:'H时mm分'})"})
                    </dd>
                </dl>
                <dl>
                    <dt>就餐人数</dt>
                    <dd>
                        @Html.DisplayFor(model => model.Order.DineNum, null, new {@class = "input normal w100", datatype = "n", value = ""})
                        <span class="Validform_checktip">人</span>
                    </dd>
                </dl>
                <dl>
                    <dt>餐位情况</dt>
                    <dd class="ltable">
                        @Html.DisplayFor(model => model.Order.Dinecondition)   @Html.DisplayFor(model => model.Order.DineTable)
                    </dd>
                </dl>  
                <dl>
                    <dt>联系人</dt>
                    <dd> 
                        @Html.DisplayFor(model => model.Order.ContactUser, null, new {@class = "input normal w100"}) 
                    </dd>
                </dl>
                <dl>
                    <dt>用户手机</dt>
                    <dd> 
                        @Html.DisplayFor(model => model.Order.ContactMobile, null, new {@class = "input normal w100"}) 
                    </dd>
                </dl>
                <dl>
                    <dt>客人信息</dt>
                    <dd> 
                        @{
                            if (Model.OrderGuest != null)
                            {
                                <table>
                                    <tr>
                                        <td class="w200">姓名</td>
                                        <td  class="w120">电话</td>
                                        <td  class="w80">状态</td> 
                                    </tr>
                                    @foreach (var guest in Model.OrderGuest)
                                    {
                                        var user = new RBS.Core.BLL.U_User().GetModelByCache(guest.GuestId);
                                        <tr>
                                            <td>@user.U_Name (@user.U_Uid)</td>
                                            <td>@user.Mobile</td>
                                            <td>
                                                @if (guest.Status == 1)
                                                {
                                                    @Html.Raw("参加")
                                                }
                                                else if (guest.Status == 2)
                                                {
                                                    @Html.Raw("不参加")
                                                    if (Model.Order.U_Id == uid)
                                                    {
                                                        @Html.Raw("</br>【" + guest.Remark + "】")
                                                    }
                                                }
                                                else
                                                {
                                                    @Html.Raw("未应答")
                                                }

                                            </td> 
                                        </tr>
                                    }
                                </table>
                            }
                        } 
                    </dd>
                </dl>
                <dl>
                    <dt>订单备注</dt>
                    <dd> 
                        @Html.DisplayFor(model => model.Order.OrderRemark, null, new {@class = "input normal"}) 
                    </dd>
                </dl> 

            </div>
        </div>
        <div id="sideContent">  
            <div class="mymenu">
                <h2>我的菜单</h2>
                <div class="menulist">
                    <ul id="orderUL">
                        @{
                            var numcount = 0;
                            decimal priceCount = 0;
                            foreach (var item in Model.OrderDetails)
                            {
                                numcount += item.Num;
                                priceCount += (item.Num*item.Price);
                                <li>  
                                    <div class="food-count-name">@item.CName</div>
                                    <div class="food-count-price">@item.Price </div> 
                                    <div class="food-count-reduce"  ></div>
                                    <div class="food-count-num">@item.Num </div> 
                                    <div class="food-count-add">份</div>
                                </li>
                            }
                        } 
                    </ul> 
                    @{ 
                        <div class="total-warp">  
                          @*  <dl class="price">
                                <dd class="item-count">我的优惠券</dd>
                                <dd class="item-tit">
                                    <ul>
                                        @if (Model.UserDeed == null)
                                        {
                                            <li>无优惠卷信息</li>
                                        }
                                        else
                                        {
                                            foreach (var row in Model.UserDeed)
                                            {
                                                if (row.DeedType == 1)
                                                {
                                                    <li> 
                                                        <input id="@row.Id" type="checkbox"  name="SendFood" datatype="max2" sucmsg=" "  value="@row.Id" /> 
                                                        <label for="@row.Id">@row.Crowd [送采券]</label> 
                                                    </li>
                                                }
                                                if (row.DeedType == 2)
                                                {
                                                    <li> 
                                                        <input id="@row.Id" type="checkbox"  name="Consumption" datatype="max2" sucmsg=" " value="@row.Id" /> 
                                                        <label for="@row.Id">@row.Crowd  [消费券]</label> 
                                                    </li>
                                                }
                                                if (row.DeedType == 3)
                                                {
                                                    <li> 
                                                        <input id="@row.Id" type="checkbox"  name="Advertis" datatype="max2" sucmsg=" " value="@row.Id" /> 
                                                        <label for="@row.Id">@row.Crowd  [广告券]</label> 
                                                    </li>
                                                }
                                            }
                                        } 
                                    </ul>
                                </dd>
                                <dd class="item-label"></dd>  
                            </dl>  
                            <dl class="price">
                                <dd class="item-count">我的积分：<b id="UserIntegration">@Model.UserIntegration</b>分</dd>
                                <dd class="item-tit">使用积分：<input type="text" value="0" class="input small"/></dd>
                                <dd class="item-label"></dd>  
                            </dl> 
                   *@
               
                   
                            <dl class="price">
                                <dd class="item-count">合计数量：<b id="numcount">@numcount</b>份</dd>
                                <dd class="item-tit">合计金额：<b>¥</b> <strong id="priceCount">@priceCount </strong></dd>
                                <dd class="item-label"></dd> 
                                <dd class="price-other">菜单金额以实际消费为准</dd>
                            </dl>
                            @Html.ActionLink("上一步", "SetCookBook", "Yd", new {id = Model.Hotel.H_id, orderid = Model.Order.Id, type = "edit"}, new {@class = "next-btn"})
                            @*	<a class="next-btn" href="#" id="BtnNextOrder">下一步</a>*@
                            <input type="submit" value="提交" id="btnSubmitOk" style="display: none" /> 
                            <a href="javascript:;" class="next-btn" id="btnSubmit">提交</a>  
                     
                        </div>
                           }  
                </div>
            </div> 
        </div> 
    </div>
}
<script> 
    $(function () {
        //金额不能小于0
        $.extend($.Datatype, {
            "ck": function (gets, obj, curform, regxp) {
                if (parseInt(gets) < 0) {
                    return false;
                }
                return true;
            },
            "max2": function (gets, obj, curform, regxp) {
                var atmax = 1,
                    numselected = curform.find("input[name='" + obj.attr("name") + "']:checked").length;

                if (numselected > atmax) {
                    return "每种优惠券最多只能选择" + atmax + "项！";
                }
                return true;
            }
        }); 
        $("#btnSubmit").click(function() {
            $("#btnSubmitOk").click();
        }); 
    });  
</script>
 